﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.Storage.Streams;
using Windows.Security.Cryptography;
using Windows.Security.Cryptography.Core;


namespace CC98.Security
{
    public static class MD5Helper
    {
        public static string ComputeMD5(this string content)
        {
            var md5Algorithm = HashAlgorithmProvider.OpenAlgorithm("MD5");
            IBuffer buffer = CryptographicBuffer.ConvertStringToBinary(content, BinaryStringEncoding.Utf8);
            var hashed = md5Algorithm.HashData(buffer);
            return CryptographicBuffer.EncodeToHexString(hashed).ToLower();
        }
    }
}
